default_platform(:android)

platform :android do
  desc "Deploy a new version to the Google Play"
  lane :deploy do
    gradle(task: "clean bundleRelease")
    upload_to_play_store(
      track: 'alpha',
      skip_upload_apk: true,
      skip_upload_metadata: true,
      skip_upload_changelogs: true,
      skip_upload_images: true,
      skip_upload_screenshots: true
    )
    upload_to_play_store(
      track: "alpha",
      track_promote_to: "beta",
      skip_upload_apk: true,
      skip_upload_aab: true,
      skip_upload_metadata: true,
      skip_upload_changelogs: true,
      skip_upload_images: true,
      skip_upload_screenshots: true
    )
  end

  desc "Download the APK from the Play Console"
  lane :download_apk do |options|
    download_universal_apk_from_google_play(
      version_code: options[:version_code],
      destination: "./io.github.fate_grand_automata-" + options[:version_code] + ".apk"
    )
  end
end
